package com.sky.service;

import com.sky.dao.--CLASS_NAME--Mapper;
import com.sky.model.BaseModel;
import com.sky.model.--CLASS_NAME--;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhijun.guo
 * @create 2019-03-23 23:33
 **/
@Service
public class --CLASS_NAME--Service {

    @Autowired
    --CLASS_NAME--Mapper --CLASS_NAME--Mapper;

    public List<BaseModel> query(--CLASS_NAME-- --CLASS_NAME--) {
        return --CLASS_NAME--Mapper.query(--CLASS_NAME--);
    }

    public int insert(--CLASS_NAME-- record) {
        record.setId(UUID.randomUUID().toString());
        return --CLASS_NAME--Mapper.insertSelective(record);
    }

    public BaseModel selectById(String id) {
        return this.--CLASS_NAME--Mapper.selectByPrimaryKey(id);
    }

    public int update(--CLASS_NAME-- --CLASS_NAME--) {
        return this.--CLASS_NAME--Mapper.updateByPrimaryKey(--CLASS_NAME--);
    }

    public int delete(String id) {
        return this.--CLASS_NAME--Mapper.deleteByPrimaryKey(id);
    }
}
